import pandas as pd
import easyquotation,random
quotation = easyquotation.use('tencent')

def tencentQuo(OQ代码,价格类型):
    # 获取委托价格
    if str(OQ代码)[0:1]=="6" or str(OQ代码)[0:1]=="5":
        腾讯代码="sh"+str(OQ代码)
    else:
        腾讯代码="sz"+str(OQ代码)
    try:
        价格=quotation.real(腾讯代码)[腾讯代码[2:8]][价格类型]
    except:
        价格=0.01
    return 价格

是否人工干预=False
T0明细=pd.read_excel(r"C:\Users\AXZQ\Desktop\AUTO\统计柜台市值\利道永晟八号dzd20230918.xls")

T0明细=T0明细[T0明细["委托编号"]==34480030]

#人工去除
# 实际手工补单=手工补单


T0明细["最新价"]=0
T0明细["市值"]=0


for index,row in T0明细.iterrows():
    最新价=tencentQuo(row["证券代码"],"now")
    print("正在处理")
    T0明细.loc[index,"最新价"]=最新价
    T0明细.loc[index,"市值"]=最新价*T0明细.loc[index,"成交数量"]
T0明细.to_excel(r"C:\Users\AXZQ\Desktop\AUTO\统计柜台市值\利道永晟八号.xlsx", index=False)


print("已完成")
